package es

import (
	"github.com/olivere/elastic/v7"
)

type Bulk struct {}

func (b *Bulk) Insert(index string) *elastic.BulkIndexRequest {
	return elastic.NewBulkIndexRequest().Index(index)
}

func (b *Bulk) Create(index string) *elastic.BulkCreateRequest {
	return elastic.NewBulkCreateRequest().Index(index)
}

func (b *Bulk) Update(index string) *elastic.BulkUpdateRequest {
	return elastic.NewBulkUpdateRequest().Index(index)
}

func (b *Bulk) Delete(index string) *elastic.BulkDeleteRequest {
	return elastic.NewBulkDeleteRequest().Index(index)
}

func (e *EsClient) BulkRequest() *elastic.BulkService {
	return e.rawClient.Bulk()
}

func (e *EsClient) BulkProcessor() *elastic.BulkProcessorService {
	return e.rawClient.BulkProcessor()
}

// explame
//func BulkList() {
//	bulk := &es.Bulk{}
//	payload := es.Client().BulkRequest()
//	for _, v := range datas {
//		req := bulk.Insert("index").Doc(v)
//		payload.Add(req)
//	}
//	return payload.Do(context.Background())
//}